The analyze() method returns a populated result containing a barcode results array of objects. Each element of the array contains the result of a single recognized barcode.
Java |
Copy Code
|
---|---|
BarcodeXpress barcodeXpress = new BarcodeXpress(); BarcodeReader barcodeReader = barcodeXpress.getReader(); barcodeReader.setBarcodeTypes(new BarcodeType[] { BarcodeType.ALL }); File inputFile = new File(inputFilePath); BufferedImage bufferedImage = ImageIO.read(inputFile); Result[] results = barcodeReader.analyze(bufferedImage); System.out.println(results.length + " barcodes found. \n"); for (int i = 0; i < results.length; i++) { System.out.println("#" + i); System.out.println("Barcode value = " + results[i].getValue()); System.out.println("Barcode type = " + results[i].getType() + "\n"); System.out.println("Barcode area: x = " + results[i].getArea().x + " y = " + results[i].getArea().y + " width = " + results[i].getArea().width + " height = " + results[i].getArea().height); Point[] points = results[i].getPoints(); System.out.format("corners: top left(%d, %d), top right(%d, %d), bottom right(%d, %d), bottom left(%d, %d)\n", points[0].x, points[0].y, points[1].x, points[1].y,points[2].x, points[2].y,points[3].x, points[3].y); System.out.println("Barcode confidence = " + results[i].getConfidence()); System.out.println("Barcode skew: " + results[i].getSkew() + "\n"); } |